<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
use think\Session;

class Jtallocation extends Base{
    public function index(){

        $user = $this->userInformation();
        if($user['RNA']!=1 || $user['assetaccount']=='00000' || $user['assetaccount'] == null) return ['msg'=>'无权限使用此接口'];
        $config = Db::name('futures_api')->where(['status'=>1,'title'=>jt])->find();
        if(!$config) return ['msg'=>'服务未开启'];
        $allocation = Db::name('user_allocation')->where(['uid'=>Session::get('uid'),'status'=>0])->find();
        if($allocation) return ['msg'=>'请先关闭已有配资'];

        $req['Action']='ReqTransfer';
        $req['UserID']=$config['sa'];
        $req['ChdAccountID']= '470635282';
        $req['PriorityAmount'] = 10000;
        // $req['UserID']='mytest';
        $req['BadAmount'] = 100;
        ksort($req);
        $url='';
        foreach ($req as $k=>$v){
        $url=$url.$k.'='.$v.'&';
        }
        $req=rtrim($url,'&');
        var_dump($req);
        $sign=md5($req.'&UserKey=e10adc3949ba59abbe56e057f20f883e');

        $req=$req.'&Sign='.$sign;
        var_dump($req);
        // $url='http://118.190.1.133:8082/AccMgrt.aspx'.'?'.$req;
        $url='http://42.96.170.88:8082/AccMgrt.aspx'.'?'.$req;
        echo '<hr>';
        var_dump($url);
        echo '<hr>';
        $res=https_request($url);
        var_dump($res);
        var_dump(json_decode($res,true));
    }


}